package com.hqyj.controller;


import com.hqyj.entity.Menu;
import com.hqyj.entity.ResultVo;
import com.hqyj.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rock
 * @since 2022-09-20
 */
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    IMenuService iMenuService;

    @GetMapping("/queryMenuByPage")
    public ResultVo queryMenuByPage(Menu menu) {
        return iMenuService.queryMenuByPage(menu);
    }

    @GetMapping("/addMenu")
    public ResultVo addMenu(Menu menu) {
        return iMenuService.addMenu(menu);
    }

    @GetMapping("/editMenu")
    public ResultVo editMenu(Menu menu) {
        return iMenuService.editMenu(menu);
    }

    @PostMapping("/delMenuByDid")
    public ResultVo delMenuByDid(Integer did) {
        return iMenuService.delMenuByDid(did);
    }

    /**
     * 修改状态
     * @param menu
     * @return
     */
    @GetMapping("/editStateByDid")
    public ResultVo editStateByDid(Menu menu) {
        return iMenuService.editStateByDid(menu);
    }
}

